/**
 * This piece of script can be used to display a message somewhere on the
 * webpage to indicate that a request has been taken, and the user has to
 * wait for a bit (or another message if you like)
 *
 * Example:
 *
 *  <td id="messagebox"></td>
 *  <a href="JavaScript:showSystemMessage( 'show me the money dude!', 'messagebox', 55 )">click</a>
 *
 * @author  rens@joxx.nl
 * @version 1.0 - 2003.11.12
 */
var m_nCountDots      = 0;
var m_bAlreadyShowing = false;
var m_sDots           = " ";

var m_nMaxDotCount    = 0;
var m_sElementId      = "status_id";
var m_sMessage        = "One moment please";

function showSystemMessage( sMessage, sElementId, nMaxDotCount )
{
  if( arguments.length < 3 )
  {
    alert( "JavaScript:showSystemMessage( .. ): missing argument" );
    return;
  }
  
  if( m_bAlreadyShowing )
  {
    return;
  }
  
  // Save the parameters before they can be used in the 'real' function
  m_nMaxDotCount  = nMaxDotCount;
  m_sElementId    = sElementId;
  m_sMessage      = sMessage;
  
  showStuff();
  m_bAlreadyShowing = true;
}

function showStuff()
{
  if( ++m_nCountDots > m_nMaxDotCount )
  {
    m_nCountDots = 0;
    m_sDots = " ";
  }
  
  m_sDots += ".";
  
  document.getElementById( m_sElementId ).innerHTML = m_sMessage + " " + m_sDots;
  
  setTimeout( "showStuff()", 200 );
}
